package com.dddd.blog.blogsp.task;


import com.dddd.blog.blogsp.pageprocessor.BlogAuthorPageProcessor;
import com.dddd.blog.blogsp.pipeline.BlogAuthorPipeline;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.Spider;

import javax.annotation.Resource;

/**
 * @author 喵星球的大橘
 */
@Component
public class BlogAuthorTask{

    @Resource
    private BlogAuthorPipeline blogAuthorPipeline;

    @Resource
    private BlogAuthorPageProcessor blogAuthorPageProcessor;

    /**
     *
     */
    public void runSpider(){
        Spider.create(blogAuthorPageProcessor)
                .addUrl("https://www.cnblogs.com/pick/1")
                .addPipeline(blogAuthorPipeline)
                .thread(5)
                .run();
    }
}
